package ari.com.http.request.parser;

import java.util.Map;

import com.ari.eft.request.type.EFTRequestFactory;
import com.ari.eft.request.type.LoginRequest;

public class RequestParserFactory {
    public static LoginRequest parseLoginRequest(final Map<String, String[]> parameters) throws ParamNotFoundException {
        LoginRequest request = (LoginRequest) EFTRequestFactory.getRequest(1 /*
                                                                              * TODO
                                                                              * Dummy
                                                                              */);
        String value = ParamUtils.getParameter("client_id", parameters);
        request.setClientIdentifier(value);
        value = ParamUtils.getParameter("password", parameters);
        request.setPassword(value);
        value = ParamUtils.getParameter("new_password", parameters);
        request.setNewPassword(value);
        value = ParamUtils.getParameter("version", parameters);
        request.setVersion(value);
        value = ParamUtils.getParameter("language", parameters);
        request.setLanguage(value);
        value = ParamUtils.getParameter("obj_uri", parameters);
        request.setObjURI(value);
        value = ParamUtils.getParameter("extensions", parameters);
        request.setExtensions(value);
        value = ParamUtils.getParameter("client_trans_id", parameters);
        request.setClientTransactionId(value);
        return request;
    }
}
